home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-03 / qbasicpg.zip / DEFFN_EX.BAS < prev    next >
BASIC Source File  |  1988-09-17  |  270b  |  15 lines

  1. '
  2. ' *** DEFFN_EX.BAS - DEF FN function programming example
  3. '
  4. DEF FNFactorial#(X)
  5.    STATIC Tmp#, I
  6.    Tmp#=1
  7.    FOR I=2 TO X
  8.       Tmp#=Tmp#*I
  9.    NEXT I
  10.    FNFactorial#=Tmp#
  11. END DEF
  12.  
  13. INPUT "Enter a number: ",Num
  14. PRINT Num "factorial is" FNFactorial#(Num)
  15.